package utils

const(
	SuccessCode int = 200
	ErrCode int = 400
	TokenErrCode int = 401  //登录过期
	SignErrCode int = 402  //登录过期
	SuccessMsg string = "Request successful"
)

type Service struct {
	HttpCode int
	Rs interface{}
}

func Success(data ...interface{}) Service{
	m:=make(map[string]interface{})
	if data!=nil{
		m["data"] = data[0]
	}
	m["msg"] = SuccessMsg
	var resp Service
	resp.HttpCode = SuccessCode
	resp.Rs=m
	return resp
}

func Error(msg interface{}) Service{
	m:=make(map[string]interface{})
	m["msg"] = msg
	var resp Service
	resp.HttpCode=ErrCode
	resp.Rs=m
	return resp
}
